#run command:sudo salt-call --local state.sls newrelic saltenv="local"
#run this install newrelic 
Yum Repo for newrelic:
  file.managed:
    - name: /etc/yum.repos.d/newrelic.repo
    - contents: |
        [newrelic]
        name=Centos - $basearch - newrelic
        baseurl=https://download.newrelic.com/pub/newrelic/el5/$basearch
        gpgcheck=0
        enabled=1

# This is the yum install
Install newrelic-sysmond:
  pkg.installed:
    - name: newrelic-sysmond

Set up  newrelic:
  cmd.run:
    - name: nrsysmond-config --set license_key={{ pillar['newrelic']['license_key'] }}
    - unless: grep "license_key={{ pillar['newrelic']['license_key'] }}" /etc/newrelic/nrsysmond.cfg
    - require_in:
      file: /etc/newrelic/nrsysmond.cfg
  file.managed:
    - name: /etc/newrelic/nrsysmond.cfg
    - replace: False
    - mode: 600
    - user: newrelic
    - group: newrelic
  service.running:
    - name: newrelic-sysmond
    - enable: True
    - watch:
      - file: /etc/newrelic/nrsysmond.cfg